package com.xiaouyudeguang.common.ditable.service;

import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.xiaouyudeguang.common.ditable.entity.DiTable;
import org.springframework.data.domain.PageImpl;

import java.util.List;
import java.util.Map;
import java.util.Set;

public interface DiTableService extends IService<DiTable> {

    String save(String tenantId, String appId, JsonNode request) throws Exception;

    boolean saveBatch(String tenantId, String appId, List<JsonNode> dataList) throws Exception;

    boolean deleteById(String tenantId, String appId, String id) throws Exception;

    boolean deleteByIds(String tenantId, String appId, Set<String> ids) throws Exception;

    boolean delete(String tenantId, String appId, SFunction<DiTable, ?> function, Object value) throws Exception;

    boolean deleteAll(String tenantId, String appId) throws Exception;

    boolean updateById(String tenantId, String appId, JsonNode request) throws Exception;

    boolean updateBatch(String tenantId, String appId, List<JsonNode> dataList) throws Exception;

    JsonNode getById(String tenantId, String appId, String id) throws Exception;

    DiTable getOne(String tenantId, String appId, SFunction<DiTable, ?> function, Object value) throws Exception;

    List<ObjectNode> getByIds(String tenantId, String appId, Set<String> ids) throws Exception;

    List<ObjectNode> list(String tenantId, String appId, JsonNode request) throws Exception;

    List<DiTable> list(String tenantId, String appId, SFunction<DiTable, ?> function, Object value) throws Exception;

    List<DiTable> list(String tenantId, String appId, SFunction<DiTable, ?> function, Set<?> values) throws Exception;

    PageImpl<ObjectNode> page(String tenantId, String appId, JsonNode request) throws Exception;

    ObjectNode getTable(String tenantId, String appId, String tableName) throws Exception;

    Map<String, String> getFieldMapping(String tenantId, String appId, String tableName) throws Exception;

    Boolean addColumn(String tenantId, String appId, String tableName, JsonNode request) throws Exception;

    Boolean updateColumn(String tenantId, String appId, String tableName, JsonNode request) throws Exception;

    Boolean deleteColumn(String tenantId, String appId, String tableName, JsonNode request) throws Exception;

    Boolean addAction(String tenantId, String appId, String tableName, JsonNode request) throws Exception;

    Boolean updateAction(String tenantId, String appId, String tableName, JsonNode request) throws Exception;

    Boolean deleteAction(String tenantId, String appId, String tableName, JsonNode request) throws Exception;

    Boolean addTab(String tenantId, String appId, String tableName, JsonNode request) throws Exception;

    Boolean updateTab(String tenantId, String appId, String tableName, JsonNode request) throws Exception;

    Boolean deleteTab(String tenantId, String appId, String tableName, JsonNode request) throws Exception;
}
